package com.woniuxy01;

import javax.swing.*;

/**
 * @author 作者
 * @create 2025-05-30 10:05
 */
public class Cat extends Animal{
    //健康值
    private int health;

    public Cat() {

    }

    public Cat(String name, int age, int health) {
        super(name, age);
        this.health = health;
    }

    public int getHealth() {
        return health;
    }

    public void setHealth(int health) {
        this.health = health;
    }

    @Override
    public String toString() {
        return super.toString()+",health:"+health;
//        return getName()+","+getAge()+","+getHealth();
    }

    @Override
    public void eat() {
        System.out.println("猫吃鱼");
    }
}
